<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>山海夭华-欢迎登录</title>
    <link rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/logincss.css">
    <script src="../js/jquery-1.10.2.min.js"></script>
    <script src="../js/form.js"></script>
    <!--此文件要放在jquery下方-->
    <style>
        html {
            width: 100%;
            height: 100%;
        }

        body {
            width: 100%;
            height: 100%;
        }
        input:-webkit-autofill{
            -webkit-text-fill-color: #000 !important;
            transition: background-color 5000s ease-in-out 0s;
        }
    </style>
</head>
<body>
<div class="container-fluid height-fluid">
    <div class="row height-fluid">
        <!-- col-xs-* col-sm-* col-md-* col-lg-* 依次为超小设备<765、手机、平板、电脑 -->
        <div
                class="col-sm-12 hidden-md visible-xs-block visible-sm-block visible-md-block bg-color title-style">
            <img alt="图片" src="../images/logo.png" class="logo-style"> <img
                alt="图片" src="../images/user_bg_m.png" class="uper">
        </div>
        <div class="col-md-8">
            <div class="row">
                <div
                        class="col-sm-8 col-md-8 col-sm-offset-2 col-md-offset-2 login-main">
                    <div class="hidden-xs hidden-sm visible-md-block visible-lg-block">
                        <img alt="图片" src="../images/logo1.png" width="150" height="35"/>
                    </div>
                    <div class="login-text">
                        Welcome Back !<br/> 欢迎您再次回来 !
                    </div>
                    <form action="../login/usertologin" class="form-horizontal" role="form"
                          method="post">
                        <div class="form-group">
                            <div class="col-sm-12 col-md-8">
                                <div class="error-text">&nbsp;</div>
                                <input type="text" name="uid" class="form-control uid"
                                       placeholder="请输入账号">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12 col-md-8">
                                <div class="error-text2" style="font-size: 12px">&nbsp;</div>
                                <input type="password" name="upswd" class="form-control upswd"
                                       placeholder="请输入密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12 col-md-6">
                                <button type="button" class="btn btn-primary btn-lg login-btn butt">
                                    <span class="span-before">登 录</span>
                                </button>
                            </div>
                        </div>
                    </form>
                    <div style="font-size: 12px">
                        <p>
                            未建立账号，请点击 <a href="register.jsp">立即注册&gt;</a>
                        </p>
                    </div>

                </div>
            </div>
        </div>

        <div
                class="hidden-sm visible-md-block visible-lg-block col-md-4 height-fluid bg-color">
            <div class="bg-img">
                <img src="../images/uper.png" class="uper2">
                <div class="text-center text-slogan">
<!--                    <p>DREAM</p>-->
<!--                    <p>Hope is not extinguished,</p>-->
<!--                    <p>Dream is the future.</p>-->
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row">
    <div class="text-center footer col-xs-12 col-sm-12 col-md-8">
        <p>
            <a href="service.jsp">隐私政策</a><i>|</i> <a href="aboutus.jsp">关于我们</a><i>|</i> <a
                href="/product/showpro">商品选购</a><i>|</i> <a href="javascript:alert('邮箱：123123');">反馈渠道</a>
        </p>

    </div>
</div>

<script type="text/javascript">

    $(function (e) {
        var uid = parseInt($(".uid").val());
        var error1 = $(".error-text");
        var error2 = $(".error-text2");
        var btn_span = $(".butt span");
        $(".butt").click(function () {
            $("form").ajaxSubmit({
                success: function (date) {
                    if (date["num_i"] > 0) {	//证明账号存在，此处date相当于controller中的object
                        error1.html(date["SUCCESS_MESSAGE"]);
                        error1.css("color", "#24b510");
                        if (date["num_j"] > 0) {	//证明密码正确
                            if(date["ERROR_MESSAGE"]=="该账号已登录！"){
                                error1.html(date["ERROR_MESSAGE"]);
                                error1.css("color", "#f00");
                            }else{
                                error2.html(date["SUCCESS_MESSAGE2"]);
                                error2.css("color", "#24b510");
                                btn_span.remove("span-before");
                                btn_span.addClass("span-before2");
                                $(".butt").find("span").html("登录中...");
                                setTimeout(function () {
                                    window.location = "../toindex";	//window.location="usertologin?userid="+uid;
                                }, 2000);
                            }
                        } else {
                            error2.html(date["ERROR_MESSAGE"]);
                            error2.css("color", "#f00");
                        }
                    } else {
                        error1.html(date["ERROR_MESSAGE"]);
                        error1.css("color", "#f00");
                    }
                },
                timeout: 5000,	//5秒超时
                error: function (xhr) {
                    if (xhr.statusText == "timeout") {
                        alert("加载超时，请重试！");
                    } else {
                        alert("温馨提示： " + xhr.status + " " + xhr.statusText+" 系统异常！");
                    }
                }
            })
        })
    })
</script>
</body>
</html>